package com.mspbots.cw.request;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mspbots.dto.BaseDTO;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * MSPBOTSAI com.mspbots.cw.request.TimeEntry
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/6/28
 */
@Data
public class TenantTimeEntryDTO implements BaseDTO {

    private Long id;

    private Long tenantId;

    private String tenantName;

    private Long cwUid;

    private Long cwTid;

    private LocalDateTime beginDate;

    private LocalDateTime endDate;

    private LocalDateTime enteredDate;

    private LocalDateTime enteredDateStart;

    private LocalDateTime enteredDateEnd;

    private Double actualHours;

    private String description;

    private JsonNode extend;

    private Long tenantUserId;

    private Long chargeToId;


    public TenantTimeEntryDTO() {
    }

    private TenantTimeEntryDTO(Long tenantId,
                               Long tenantUserId,
                               Long cwTid,
                               LocalDateTime beginDate,
                               LocalDateTime endDate,
                               Double actualHours,
                               String description,
                               ObjectNode extend, Long chargeToId) {
        this.tenantId = tenantId;
        this.cwUid = tenantUserId;
        this.cwTid = cwTid;
        this.beginDate = beginDate;
        this.endDate = endDate;
        this.actualHours = actualHours;
        this.description = description;
        this.extend = extend;
        this.chargeToId = chargeToId;
    }

    public static TenantTimeEntryDTO of(Long tenantId, Long tenantUserId, Long cwTid,
                                        LocalDateTime beginDate, LocalDateTime endDate,
                                        double actualHours, String description, ObjectNode extend, Long chargeToId) {
        return new TenantTimeEntryDTO(tenantId, tenantUserId, cwTid, beginDate, endDate, actualHours, description, extend, chargeToId);
    }

}
